<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@page import="com.cap.bts.framework.usermgnt.constant.EmployeeStatus"%>    
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>使用优惠券</title>
<%@include file="../include/include.jsp"%>
<link rel="stylesheet" type="text/css" href="${csspath }/public.css" />
<script type="text/javascript" src="${layerPath}/jquery/jquery-1.8.3.js"></script>
<script type="text/javascript" src="${layerPath }/layer.js"></script>
<link rel="stylesheet" type="text/css" href="${csspath }/datepicker.css"/>
<script type="text/javascript" src="${jspath }/ui.datepicker_zh-CN.js"></script>
<script type="text/javascript" src="${jspath }/jquery.ui.min.js"></script>
<link rel="stylesheet" type="text/css"
	href="${bootstrapPath}/css/bootstrap.css" />
</head>
<script type="text/javascript">
function redeem(){
	$.ajax({
		type:'post',
		url: '${webcontext}/crmdp/dealer/coupon/redeemCoupon',
		data : $("form").serialize(),
		success : function(data) {
			if(!data.result){
				$("#couponNumberError").html(data.msg);
				//alert(data.result);
				//alert(data.msg);
				//parent.location.reload();
				//closeLayer();
			}else{
				jAlert(data.msg,"提示信息",
					function(){
					closeLayer();
						//window.parent.search();
					});
			}
		}
	});
}

function closeLayer(){
	//当你在iframe页面关闭自身时
	var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
	parent.layer.close(index); //再执行关闭 	
	//window.parent.search();
}
</script>

<body>
<div id="content">
		<!-- wrap -->
		<div id="wrap">
		<form:form id="info_form" action="${webcontext}/crmdp/dealer/coupon/editCouponBatch" method="post" modelAttribute="dto">
		<input type="hidden" name="carId"  value="${carId}">
		  <div class="data_div">
					<table class="data_tab_blank">
						<tr>
							<th width="10%">手机</th>
							<td width="90%"><input type="hidden" name="coupon.redeemMemberPhone"  value="${dto.mobilePhone}">${dto.mobilePhone}</td>
						</tr>
						<tr>
							<th width="10%">姓名</th>
							<td width="90%"><input type="hidden" name="coupon.redeemMemberName"  value="${dto.memberName}">${dto.memberName}</td>
						</tr>
						<tr>
							<th width="10%">车牌</th>
							<td width="90%"><input type="hidden" name="coupon.redeemMemberCar" value="${dto.carPlate}">${dto.carPlate}</td>
						</tr>
						<tr>
							<th width="10%">优惠券号码</th>
							<td width="90%"><input class="form-control " style="width:150px" name="coupon.couponNumber" value=""><span id="couponNumberError" class="error">&nbsp;&nbsp;${dto.errorMsg}</span></td>
						</tr>
							</table>
							</div>
							<div class="spliter h_10"></div>           
			     			 <div class="spliter h_5"></div> 
				<div  style="width:500px;height:50px;text-align: center">
			 		<input type="button" class="btn" onClick="redeem()" value="使用"/>
                	<input type="button" class="btn" onClick="closeLayer()" value="取消"/>
        		</div>
		</form:form>
		</div>

			
            </div>
</body>
</html>